#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
| Created on 2020/5/21 16:47

| @author: aimee.mei
"""

import sys, logging,traceback
from util.db_util import execute_query


def get_sam_product_tree_id(name):
    '''


    :param name: 精选产业链name

    :return: 精选产业链id
    '''
    try:
        results = execute_query(
            "select id from scm_product_tree where name = '%s' and status !=0" % name)
        result = results[0][0]
        return result
    except Exception as e:
        logging.exception("Retrieve latest id failed!")
        logging.error(e)
        traceback.print_exc()
        return None